<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>3419：Poi2013 Taxis</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">Poi2013 Taxis</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">Poi2013 Taxis</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                Poi2013 Taxis                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：64MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><p><span style="font-size: medium">Byteasar wants to take a taxi from the town Bytehole to the town Bytepit, which is m kilometres away from Bytehole. Exactly dkilometres along the way from Bytehole to Bytepit, there is a base of n taxis, numbered from&nbsp;&nbsp; to n. The taxi no. i has enough fuel to drive exactly Xi kilometres.<br />
Byteasar can change taxis at any point. All the taxis start at their base but need not return there. Your task is to determine whether Byteasar can be driven from Bytehole to Bytepit, and if so, what it the minimum number of taxis required for such a journey.<br />
</span></p>
<p><span style="font-size: medium"><span>杭州是一个风景优美的城市，但是这里的出租车不太好打&hellip;&hellip;</span></span></p>
<pre><span style="font-size: medium">然后叫来第2辆车，第二辆车的路径为23-&gt;27-&gt;42，
小F成功回家<br />小F现在在西湖边的雷峰塔，他想打出租车回家 
但是现在出租车都在换班&hellip;&hellip;不愿意开太远(什么破理由) 
我们可以把雷峰塔到小F的家的路径抽象成一条线段，
这条线段长为m 而在线段上恰好有杭州最大的一个出租车
停车处,它到雷峰塔的距离为d 现在小F知道杭州所有的
出租车都在那个停车处那里，停车处那里有n辆车 现在由
于出租车都在换班&hellip;&hellip;它们都不愿意开太远&hellip;&hellip; 第i辆车
能开的最远路程是x[i](注意是路程不是位移) 注意所有
车都是从停车处出发的 小F坐上车之后可以随时下车，
小F也能随时呼叫来一辆停在停车处的车 注意一辆车
只能被呼叫来一次 倒霉的小F现在想回家&hellip;&hellip;你能帮他么&hellip;&hellip; 
因为他逛西湖已经走不动路了，所以他回家全程必须得做出租车，
不然他浑身难受 每叫一辆出租车小F就要付1块钱&hellip;&hellip; 
因为小F不是土豪&hellip;&hellip;所以如果有打车方案能送他回家的话，
你得给他一个花钱最少的方案&hellip;&hellip; 如果小F不能打车回家的话&hellip;&hellip;
请给他一个0让他开心一下&mdash;&mdash;至少他不用花钱了 
Input 
第一行三个正整数：m,d,n 
第二行n个正整数：第i个整数表示xi
 Output 
如果能回去，输出最小的花费 
否则输出0 
Sample Input 
42 23 6 20 25 14 27 30 7 
Sample Output 
4 
Hint 
样例解释： 我们用数字表示一个位置的坐标，例如样例里停
车处坐标为23，雷峰塔坐标为0 一个最优打车方案是这样的： 
小F先叫来第4辆车，第4辆车的路径为：23-&gt;0-&gt;4，小F由此
到达了4 然后叫来第5辆车，第5辆的路径为：23-&gt;4-&gt;15，小
F由此到达了15 然后叫来第1辆车，第1辆车的路径为23-&gt;15-&gt;27，
小F到达了27 </span></pre>
<p></p></p><hr/><h3>输入格式</h3><p><p><font size="4">The first line of the standard input holds three integers,m,d and n (1&lt;=d&lt;=10^18,1&lt;=N&lt;=500000), separated by single spaces. Those denote, respectively: the distance from Bytehole to Bytepit, the distance from Bytehole to the taxi base, and the number of taxis at the base. The second line of input contains n integers, x1,x2&hellip;Xn (1&lt;=Xi&lt;=10^18), separated by single spaces. The number Xi denotes the maximum distance (in kilometres) that the i-th taxi can travel.<br />
</font></p></p><hr/><h3>输出格式</h3><p><p><font size="4">Your program should print a single integer to the standard output: the minimum number of taxis Byteasar has to take to get from Bytehole to Bytepit. If getting there is impossible, your program should print the number 0.<br />
</font></p></p><hr/><h3>样例输入</h3><pre>42 23 6
20 25 14 27 30 7
</pre><hr/><h3>样例输出</h3><pre>4
Explanation of the example: Byteasar can take the taxis no. 4, 5, 1, and 2, in this order.</pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>鸣谢Wcmg提供译文</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=3419" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=3419" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>